package com.example.edittextdemo;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private String userName;
    private String passwd;
    private String conformPasswd;
    private String phone;
    private String email;
    private String qqNum;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final EditText editUser = findViewById(R.id.edit_user);

        Button btnRegister = findViewById(R.id.button_register);
        btnRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                userName = editUser.getText().toString();
                passwd = ((EditText) findViewById(R.id.edit_password)).getText().toString();
                conformPasswd = ((EditText) findViewById(R.id.edit_conform_password)).getText().toString();
                phone = ((EditText) findViewById(R.id.edit_phone)).getText().toString();
                email = ((EditText) findViewById(R.id.edit_email)).getText().toString();
                qqNum = ((EditText) findViewById(R.id.edit_qq)).getText().toString();
                String strInfo = "你输入的用户名为：" + userName
                        + "\n你的电话号码为：" + passwd
                        + "\n你的E-mail地址为：" + email;
                TextView textView = findViewById(R.id.text_show);
                textView.setText(strInfo);
                textView.setTextSize(25);
            }
        });


    }
}